In [2]:
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
from gtts import gTTS
import matplotlib
import numpy 
from traitlets.config.manager import BaseJSONConfigManager
path = "/Users/Kristen/anaconda3/envs/py36/etc/jupyter/nbconfig"
cm = BaseJSONConfigManager(config_dir=path)
cm.update("livereveal", {"autolaunch": True,
                         "theme": "sky",
                        } 
)

#Supress default INFO logging
# The UT Dallas Art Science Lab Training module 
print ("Sonification Training Module v0.5.2")
print("\nDeveloped by the ArtSciLab at UT Dallas")
print("\n")
print("Full or Empty Training Module" )
print("\n")
print("\nBasic Instructions for each cell :")
print('1. Press Shift + Enter to initiate display')
print("2. Press Space Bar to proceed to the next cell")
print("\n")
print("Volume controls are located in the top row of the keyboard if you need to adjust the volume at any time")


Sonification Training Module v0.5.2

Developed by the ArtSciLab at UT Dallas


Full or Empty Training Module



Basic Instructions for each cell :
1. Press Shift + Enter to initiate display
2. Press Space Bar to proceed to the next cell


Volume controls are located in the top row of the keyboard if you need to adjust the volume at any time

In [7]:
import random
from gtts import gTTS
import time
from IPython.display import Image, display, clear_output
from ipywidgets import widgets
import os
import platform
speechflag = 0
if (platform.system()=='Windows'):
    speechflag = 2
if (platform.system()!='Windows'):
    speechflag = 1

print("Press Shift+Enter once to initiate instructions")
display(Image('dep/images/glasses.jpg'))
tts = gTTS(text=('In this sonification,we try to represent the emptiness or fullness of something. For instance a drop of water falling into an empty glass sounds like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("dep/audio/afplay num.mp3")
                os.system("dep/audio/afplay empty.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/empty.mp3")


tts = gTTS(text=('Or the same drop of water falling into a full glass might sound like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay dep/audio/full.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/full.mp3")

tts = gTTS(text=('Notice, as how the saying goes, it is difficult to say if a glass is half empty '), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay half_empty.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/half_empty.mp3")

tts = gTTS(text=('or half full '), lang='en')
tts.save("num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay dep/audio/half_full.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/half_full.mp3")

tts = gTTS(text=('Ok. Press space bar to go to the next section where you can explore this sonification before taking the test'), lang='en')
tts.save("num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")            

print("Press Space Bar to proceed")


Press Shift+Enter once to initiate instructions
Press Space Bar to proceed

You have completed the Training Module

Now that you have the general idea of this sound representation, it is time to move on to the next phase where you can explore this sonification.

Please close this tab and open the next module from the list of notebooks:

3. Full or Empty Exploration Module